package com.sense.kukoo.common.media.bean

import android.os.Parcelable
import com.sense.kukoo.common.repo.http.bean.IndexContentBean
import kotlinx.parcelize.Parcelize

//存在本地的播放列表
@Parcelize
data class LocalMediaListItemBean(

    //var book: BookItemBean? = null,//单集内容
    //var mCoverUrl	    :String? = null,//封面URL	string
    //var isSubscription	:Int? = null,//是否订阅: 0. 否; 1. 是;	integer(int32)
    //var name	        :String? = null,//合集的名称	string
    //var chapterTotal	:Int? = null,//章节数	integer(int64)
    //var isChapter	    :Int? = null,//是否单集: 0. 否; 1. 是;	integer(int32)
    //var type	        :Int = 0,//书籍类型: 0. 未定义; 1. 有声书; 2. 播客; 3. 短内容;	integer

    val data: IndexContentBean,

): Parcelable {

    companion object{
        private val defMusic = LocalMediaListItemBean(IndexContentBean(
                audioUrl = "",
                avatarUrl = "",//用户头像URL	string
                channelName = "",//频道名称	string
                coverUrl = "",//封面URL	string
                description = "",//简介	string
                duration = 0,//时长(单位: 秒)	integer(int32)
                id = -1L,//主键ID	integer(int64)
                level = "",//审核质量:S A N F	string
                likeNum = 0,//integer(int32)
                listenNum = 0,//integer(int32)
                source = 1,//来源: 1. 自制; 2. 转载;	integer(int32)
                title = "",//标题	string
                typeId = 0,//类别ID	integer(int64)
                userId = 0,//用户ID	integer(int64)
                state = -2,//状态: -2. 禁用; -1. 未通过; 0. 待审核; 1. 启用	integer(int32)
                commentNum = 0,//评论数量	integer(int32)
                modifiedAt = "",//最后修改时间	integer(int64)
        ))

        fun getDefMusic(): LocalMediaListItemBean = defMusic
    }

    fun isDefMusic(): Boolean = this == defMusic

    fun getAudioUrl():String{
        return data.audioUrl ?: ""
    }

    fun titleOfBooks():String{
        return data.channelName ?: ""
    }

    fun titleOfChapter():String{
        return data.title ?: ""
    }

    fun coverOfBooks():String{
        return data.avatarUrl ?: ""
    }

    fun coverOfChapter():String{
        return data.coverUrl ?: ""
    }

    fun idOfBooks():Long{
        return data.userId ?: -1L
    }

    fun idOfChapter():Long{
        return data.id ?: -1L
    }

    fun authorOfBook():String{
        return data.channelName ?: ""
    }

    fun duration():Int{
        return data.duration ?: -1
    }

}